package com.ywu.api.service.standard.api;

import com.ywu.api.service.standard.dto.ApiServiceInfoDto;
import com.ywu.api.service.standard.service.ApiServiceInfoService;
import com.ywu.common.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ApiServiceInfoApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/8/9 9:41
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/api/service")
public class ApiServiceInfoApi {

    @Autowired
    private ApiServiceInfoService service;


    /**
    * @Author GroundDemo
    * @Description 添加接口服务模板
    * @Date 9:43 2025/8/9
    * @Param [dto]
    * @return java.lang.Object
    **/
    @PostMapping("/create.api.service.info")
    public CommonResult<Object> createApiServiceInfo(@RequestBody ApiServiceInfoDto dto) {
        return service.createApiServiceInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改服务接口模板
    * @Date 9:51 2025/8/9
    * @Param [dto]
    * @return java.lang.Object
    **/
    @PostMapping("/update.api.service.info")
    public CommonResult<Object> updateApiServiceInfo(@RequestBody ApiServiceInfoDto dto) {
        return service.updateApiServiceInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 刪除服务接口模板
    * @Date 9:55 2025/8/9
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.api.service.info")
    public CommonResult<Object> deleteApiServiceInfo(@RequestBody ApiServiceInfoDto dto) {
        return service.deleteApiServiceInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 分页查询接口模板
    * @Date 9:57 2025/8/9
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.api.service.info.page")
    public CommonResult<Object> queryApiServiceInfoPageList(@RequestBody ApiServiceInfoDto dto) {
        return service.queryPageList(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 根据应用ID查询应用下的所有接口模板
    * @Date 9:57 2025/8/9
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.application.api.service.info")
    public CommonResult<Object> queryApiServiceByApplicationId(@RequestBody ApiServiceInfoDto dto) {
        return service.queryApiServiceByApplicationId(dto);
    }

}
